package com.jida.hadoop.mr.DPD7;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;
 
import java.io.IOException;
 
 
 
public class ReducerDxProStatistic extends Reducer<Text,IntWritable,Text,NullWritable>{
    private Text k3 = new Text();
 
    @Override
    protected void reduce(Text key, Iterable<IntWritable> values, Context context) throws IOException, InterruptedException {
        int sum = 0;
        for(IntWritable v:values){
            sum+=v.get();
        }
        String[] ss = key.toString().split(",");
        k3.set(ss[0]+"|"+ss[1]+"|"+sum+"|"+ss[2]);
        context.write(k3,NullWritable.get());
    }
}
